<?xml version="1.0"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><head><title>SASAPI</title><script src="../../../quicknav.js" type="text/javascript"></script><script><!--
document.quicknavBasePath="../../../index-files";
//--></script><link href="../../../style.css" title="JavaDoc" rel="stylesheet" type="text/css"/><link href="../../../unnatural.css" title="Unnatural" rel="alternate stylesheet" type="text/css"/><link href="../../../overview-summary.html" title="Overview" rel="top"/><meta name="generator" content="http://www.badgers-in-foil.co.uk/projects/as2api/"/></head><body><pre><span class="lineno" id="1">     1  </span><span class="comment doc">/**
<span class="lineno" id="2">     2  </span> * com.sekati.log.Logger
<span class="lineno" id="3">     3  </span> * @version 1.2.6
<span class="lineno" id="4">     4  </span> * @author jason m horwitz | sekati.com
<span class="lineno" id="5">     5  </span> * Copyright (C) 2007  jason m horwitz, Sekat LLC. All Rights Reserved.
<span class="lineno" id="6">     6  </span> * Released under the MIT License: http://www.opensource.org/licenses/mit-license.php
<span class="lineno" id="7">     7  </span> */</span>
<span class="lineno" id="8">     8  </span>
<span class="lineno" id="9">     9  </span><span class="key">import</span> com.sekati.events.Dispatcher;
<span class="lineno" id="10">    10  </span><span class="key">import</span> com.sekati.log.Inspector;
<span class="lineno" id="11">    11  </span><span class="key">import</span> com.sekati.log.LCBinding;
<span class="lineno" id="12">    12  </span><span class="key">import</span> com.sekati.log.LogEvent;
<span class="lineno" id="13">    13  </span><span class="key">import</span> com.sekati.time.StopWatch;
<span class="lineno" id="14">    14  </span>
<span class="lineno" id="15">    15  </span><span class="comment doc">/**
<span class="lineno" id="16">    16  </span> * Logger is a multi-tiered debugging tool designed to clarify the debugging process.\
<span class="lineno" id="17">    17  </span> * 
<span class="lineno" id="18">    18  </span> * @TODO Add reflection to origin &amp; clarify mode usage.
<span class="lineno" id="19">    19  </span> * 
<span class="lineno" id="20">    20  </span> * The Logger consists of two main tiered components:
<span class="lineno" id="21">    21  </span> * 	- "levels" (method calls, i.e. 'trace', 'info', 'status', etc).
<span class="lineno" id="22">    22  </span> * 	- "filters" (origin of the level call, i.e. '_root', 'myClassInstance', 'myMc', etc).
<span class="lineno" id="23">    23  </span> * 	
<span class="lineno" id="24">    24  </span> * New level (methods) may be created dynamically "overloading" the singleton class 
<span class="lineno" id="25">    25  </span> * via {@link setLevel}, __resolve &amp; proxy as illustrated in the example usage below.
<span class="lineno" id="26">    26  </span> * NOTE: custom levels/overloading requires publishing &gt;= Flash 9.
<span class="lineno" id="27">    27  </span> * 
<span class="lineno" id="28">    28  </span> * Logger can be configured to display its output in several different ways:
<span class="lineno" id="29">    29  </span> * 	- Flash IDE Output Panel.
<span class="lineno" id="30">    30  </span> * 	- {@link Console} hidden inside compiled swf.
<span class="lineno" id="31">    31  </span> * 	- {@link Console} via &lt;a href="http://debug.sekati.com"&gt;http://debug.sekati.com&lt;/a&gt; localConnection.
<span class="lineno" id="32">    32  </span> * 
<span class="lineno" id="33">    33  </span> * @see {@link com.sekati.log.Console}
<span class="lineno" id="34">    34  </span> */</span>
<span class="lineno" id="35">    35  </span><span class="key">class</span> com.sekati.log.Logger {
<span class="lineno" id="36">    36  </span>
<span class="lineno" id="37">    37  </span>	<span class="key">private</span> <span class="key">static</span> <span class="key">var</span> _instance:Logger;
<span class="lineno" id="38">    38  </span>	<span class="key">private</span> <span class="key">var</span> _levels:Object;
<span class="lineno" id="39">    39  </span>	<span class="key">private</span> <span class="key">var</span> _filters:Array;
<span class="lineno" id="40">    40  </span>	<span class="key">private</span> <span class="key">var</span> _proxyObj:Object;
<span class="lineno" id="41">    41  </span>	<span class="key">private</span> <span class="key">var</span> _watch:StopWatch;
<span class="lineno" id="42">    42  </span>	<span class="key">private</span> <span class="key">var</span> _logId:Number;
<span class="lineno" id="43">    43  </span>	<span class="comment">// output modes</span>
<span class="lineno" id="44">    44  </span>	<span class="key">private</span> <span class="key">var</span> _isEnabled:Boolean;
<span class="lineno" id="45">    45  </span>	<span class="key">private</span> <span class="key">var</span> _isOutputLC:Boolean;
<span class="lineno" id="46">    46  </span>	<span class="key">private</span> <span class="key">var</span> _isOutputSWF:Boolean;
<span class="lineno" id="47">    47  </span>	<span class="key">private</span> <span class="key">var</span> _isOutputIDE:Boolean;	
<span class="lineno" id="48">    48  </span>	<span class="comment">// default level stubs</span>
<span class="lineno" id="49">    49  </span>	<span class="key">public</span> <span class="key">var</span> trace:Function;
<span class="lineno" id="50">    50  </span>	<span class="key">public</span> <span class="key">var</span> info:Function;
<span class="lineno" id="51">    51  </span>	<span class="key">public</span> <span class="key">var</span> notice:Function;	
<span class="lineno" id="52">    52  </span>	<span class="key">public</span> <span class="key">var</span> status:Function;
<span class="lineno" id="53">    53  </span>	<span class="key">public</span> <span class="key">var</span> warn:Function;
<span class="lineno" id="54">    54  </span>	<span class="key">public</span> <span class="key">var</span> error:Function;
<span class="lineno" id="55">    55  </span>	<span class="key">public</span> <span class="key">var</span> fatal:Function;
<span class="lineno" id="56">    56  </span>
<span class="lineno" id="57">    57  </span>	<span class="comment doc">/**
<span class="lineno" id="58">    58  </span>	 * Singleton Private Constructor
<span class="lineno" id="59">    59  </span>	 */</span>
<span class="lineno" id="60">    60  </span>	<span class="key">private</span> <span class="key">function</span> Logger() {
<span class="lineno" id="61">    61  </span>		resetLevels( );
<span class="lineno" id="62">    62  </span>		resetFilters( );
<span class="lineno" id="63">    63  </span>		_proxyObj = <span class="key">new</span> Object( );
<span class="lineno" id="64">    64  </span>		_watch = <span class="key">new</span> StopWatch( <span class="key">true</span> );
<span class="lineno" id="65">    65  </span>		_logId = <span class="num_const">0</span>;
<span class="lineno" id="66">    66  </span>		
<span class="lineno" id="67">    67  </span>		_isEnabled = <span class="key">true</span>;		
<span class="lineno" id="68">    68  </span>		_isOutputLC = <span class="key">false</span>;
<span class="lineno" id="69">    69  </span>		_isOutputSWF = <span class="key">false</span>;
<span class="lineno" id="70">    70  </span>		_isOutputIDE = <span class="key">false</span>;
<span class="lineno" id="71">    71  </span>	}
<span class="lineno" id="72">    72  </span>
<span class="lineno" id="73">    73  </span>	<span class="comment doc">/**
<span class="lineno" id="74">    74  </span>	 * Singleton Accessor
<span class="lineno" id="75">    75  </span>	 * @return Logger
<span class="lineno" id="76">    76  </span>	 */</span>	
<span class="lineno" id="77">    77  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> getInstance():Logger {
<span class="lineno" id="78">    78  </span>		<span class="key">if</span> (!_instance) _instance = <span class="key">new</span> Logger( );
<span class="lineno" id="79">    79  </span>		<span class="key">return</span> _instance;
<span class="lineno" id="80">    80  </span>	}
<span class="lineno" id="81">    81  </span>
<span class="lineno" id="82">    82  </span>	<span class="comment doc">/**
<span class="lineno" id="83">    83  </span>	 * Shorthand singleton accessor getter
<span class="lineno" id="84">    84  </span>	 * @return Logger
<span class="lineno" id="85">    85  </span>	 */</span>
<span class="lineno" id="86">    86  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> get $():Logger {
<span class="lineno" id="87">    87  </span>		<span class="key">return</span> Logger.getInstance( );	
<span class="lineno" id="88">    88  </span>	}
<span class="lineno" id="89">    89  </span>
<span class="lineno" id="90">    90  </span>	<span class="comment">// Core Controllers</span>
<span class="lineno" id="91">    91  </span>	
<span class="lineno" id="92">    92  </span>	<span class="comment doc">/**
<span class="lineno" id="93">    93  </span>	 * enabled setter
<span class="lineno" id="94">    94  </span>	 * @param b (Boolean) enable or disable Logger
<span class="lineno" id="95">    95  </span>	 */</span>
<span class="lineno" id="96">    96  </span>	<span class="key">public</span> <span class="key">function</span> set enabled(b:Boolean):Void {
<span class="lineno" id="97">    97  </span>		_isEnabled = b;
<span class="lineno" id="98">    98  </span>	}
<span class="lineno" id="99">    99  </span>
<span class="lineno" id="100">   100  </span>	<span class="comment doc">/**
<span class="lineno" id="101">   101  </span>	 * enabled getter
<span class="lineno" id="102">   102  </span>	 * @return Boolean
<span class="lineno" id="103">   103  </span>	 */</span>	
<span class="lineno" id="104">   104  </span>	<span class="key">public</span> <span class="key">function</span> get enabled():Boolean {
<span class="lineno" id="105">   105  </span>		<span class="key">return</span> _isEnabled;
<span class="lineno" id="106">   106  </span>	}
<span class="lineno" id="107">   107  </span>
<span class="lineno" id="108">   108  </span>	<span class="comment doc">/**
<span class="lineno" id="109">   109  </span>	 * level and filter _status getter
<span class="lineno" id="110">   110  </span>	 * @return String
<span class="lineno" id="111">   111  </span>	 */</span>
<span class="lineno" id="112">   112  </span>	<span class="key">public</span> <span class="key">function</span> get _status():String {
<span class="lineno" id="113">   113  </span>		<span class="key">return</span> getLevels( ) + <span class="str_const">"\n"</span> + getFilters( );
<span class="lineno" id="114">   114  </span>	}
<span class="lineno" id="115">   115  </span>
<span class="lineno" id="116">   116  </span>	<span class="comment doc">/**
<span class="lineno" id="117">   117  </span>	 * reset Out to default levels and filters
<span class="lineno" id="118">   118  </span>	 * @return Void
<span class="lineno" id="119">   119  </span>	 */</span>
<span class="lineno" id="120">   120  </span>	<span class="key">public</span> <span class="key">function</span> reset():Void {
<span class="lineno" id="121">   121  </span>		setAllLevels( <span class="key">true</span> );
<span class="lineno" id="122">   122  </span>		resetFilters( );
<span class="lineno" id="123">   123  </span>	}
<span class="lineno" id="124">   124  </span>
<span class="lineno" id="125">   125  </span>	<span class="key">public</span> <span class="key">function</span> set isLC(b:Boolean):Void {
<span class="lineno" id="126">   126  </span>		_isOutputLC = b;
<span class="lineno" id="127">   127  </span>	}
<span class="lineno" id="128">   128  </span>
<span class="lineno" id="129">   129  </span>	<span class="key">public</span> <span class="key">function</span> set isSWF(b:Boolean):Void {
<span class="lineno" id="130">   130  </span>		_isOutputSWF = b;
<span class="lineno" id="131">   131  </span>	}
<span class="lineno" id="132">   132  </span>
<span class="lineno" id="133">   133  </span>	<span class="key">public</span> <span class="key">function</span> set isIDE(b:Boolean):Void {
<span class="lineno" id="134">   134  </span>		_isOutputIDE = b;
<span class="lineno" id="135">   135  </span>	}		
<span class="lineno" id="136">   136  </span>
<span class="lineno" id="137">   137  </span>	<span class="comment">// Level Handlers</span>
<span class="lineno" id="138">   138  </span>
<span class="lineno" id="139">   139  </span>	<span class="comment doc">/**
<span class="lineno" id="140">   140  </span>	 * Enable/disable a level and create the level if it does not already exist.
<span class="lineno" id="141">   141  </span>	 * @param level (String) level name
<span class="lineno" id="142">   142  </span>	 * @param isEnabled (Boolean) enabled status
<span class="lineno" id="143">   143  </span>	 * @return Void
<span class="lineno" id="144">   144  </span>	 */</span>
<span class="lineno" id="145">   145  </span>	<span class="key">public</span> <span class="key">function</span> setLevel(level:String, isEnabled:Boolean):Void {
<span class="lineno" id="146">   146  </span>		_levels[level.toLowerCase( )] = isEnabled;
<span class="lineno" id="147">   147  </span>	}
<span class="lineno" id="148">   148  </span>
<span class="lineno" id="149">   149  </span>	<span class="comment doc">/**
<span class="lineno" id="150">   150  </span>	 * Enable or disable all existing levels.
<span class="lineno" id="151">   151  </span>	 * @param isEnabled (Boolean) enabled status
<span class="lineno" id="152">   152  </span>	 * @return Void
<span class="lineno" id="153">   153  </span>	 */</span>
<span class="lineno" id="154">   154  </span>	<span class="key">public</span> <span class="key">function</span> setAllLevels(isEnabled:Boolean):Void {
<span class="lineno" id="155">   155  </span>		<span class="key">for</span> (<span class="key">var</span> i <span class="key">in</span> _levels) {
<span class="lineno" id="156">   156  </span>			setLevel( _levels[i], isEnabled );
<span class="lineno" id="157">   157  </span>		}
<span class="lineno" id="158">   158  </span>	}
<span class="lineno" id="159">   159  </span>
<span class="lineno" id="160">   160  </span>	<span class="comment doc">/**
<span class="lineno" id="161">   161  </span>	 * Reset all levels (clearing previously created levels)
<span class="lineno" id="162">   162  </span>	 * @return Void
<span class="lineno" id="163">   163  </span>	 */</span>
<span class="lineno" id="164">   164  </span>	<span class="key">public</span> <span class="key">function</span> resetLevels():Void {
<span class="lineno" id="165">   165  </span>		_levels = {trace:<span class="key">true</span>, info:<span class="key">true</span>, status:<span class="key">true</span>, warn:<span class="key">true</span>, error:<span class="key">true</span>, fatal:<span class="key">true</span>, object:<span class="key">true</span>};
<span class="lineno" id="166">   166  </span>	}
<span class="lineno" id="167">   167  </span>
<span class="lineno" id="168">   168  </span>	<span class="comment doc">/**
<span class="lineno" id="169">   169  </span>	 * Returns a stringified overview of all levels statuses.
<span class="lineno" id="170">   170  </span>	 * @return String
<span class="lineno" id="171">   171  </span>	 */</span>
<span class="lineno" id="172">   172  </span>	<span class="key">public</span> <span class="key">function</span> getLevels():String {
<span class="lineno" id="173">   173  </span>		<span class="key">var</span> a:Array = <span class="key">new</span> Array( );
<span class="lineno" id="174">   174  </span>		<span class="key">for</span> (<span class="key">var</span> i <span class="key">in</span> _levels) {
<span class="lineno" id="175">   175  </span>			a.push( i + <span class="str_const">":"</span> + _levels[i].toString( ) );
<span class="lineno" id="176">   176  </span>		}
<span class="lineno" id="177">   177  </span>		<span class="key">return</span> <span class="str_const">"_levels={"</span> + a.toString( ) + <span class="str_const">"};"</span>;
<span class="lineno" id="178">   178  </span>	}
<span class="lineno" id="179">   179  </span>
<span class="lineno" id="180">   180  </span>	<span class="comment doc">/**
<span class="lineno" id="181">   181  </span>	 * object is a special level (method) which handles object recursion via {@link com.sekati.log.Inspector}
<span class="lineno" id="182">   182  </span>	 * @param origin (Object) origin for filtering purposes
<span class="lineno" id="183">   183  </span>	 * @param obj (Object) object to be recursed thru Out
<span class="lineno" id="184">   184  </span>	 * @return Void 
<span class="lineno" id="185">   185  </span>	 */</span>
<span class="lineno" id="186">   186  </span>	<span class="key">public</span> <span class="key">function</span> object(origin:Object, obj:Object):Void {
<span class="lineno" id="187">   187  </span>		<span class="key">var</span> insp:Inspector = <span class="key">new</span> Inspector( obj, origin );
<span class="lineno" id="188">   188  </span>		_output( <span class="str_const">"OBJECT"</span>, origin, insp );
<span class="lineno" id="189">   189  </span>	}	
<span class="lineno" id="190">   190  </span>
<span class="lineno" id="191">   191  </span>	<span class="comment">// Filter Handlers</span>
<span class="lineno" id="192">   192  </span>	
<span class="lineno" id="193">   193  </span>	<span class="comment doc">/**
<span class="lineno" id="194">   194  </span>	 * Enable/disable a filter and create the filter if it does not already exist.
<span class="lineno" id="195">   195  </span>	 * @param origin (Object) object to filter on [usually a string]
<span class="lineno" id="196">   196  </span>	 * @param isFiltered (Boolean)
<span class="lineno" id="197">   197  </span>	 * @return Void
<span class="lineno" id="198">   198  </span>	 */</span>
<span class="lineno" id="199">   199  </span>	<span class="key">public</span> <span class="key">function</span> setFilter(origin:Object, isFiltered:Boolean):Void {
<span class="lineno" id="200">   200  </span>		<span class="key">if</span> (isFiltered) {
<span class="lineno" id="201">   201  </span>			filter( origin );
<span class="lineno" id="202">   202  </span>		} <span class="key">else</span> {
<span class="lineno" id="203">   203  </span>			unfilter( origin );
<span class="lineno" id="204">   204  </span>		}
<span class="lineno" id="205">   205  </span>	}
<span class="lineno" id="206">   206  </span>
<span class="lineno" id="207">   207  </span>	<span class="comment doc">/**
<span class="lineno" id="208">   208  </span>	 * Returns a stringified overview of all filters statuses.
<span class="lineno" id="209">   209  </span>	 * @return String
<span class="lineno" id="210">   210  </span>	 */</span>
<span class="lineno" id="211">   211  </span>	<span class="key">public</span> <span class="key">function</span> getFilters():String {
<span class="lineno" id="212">   212  </span>		<span class="key">return</span> <span class="str_const">"_filters=["</span> + _filters.toString( ) + <span class="str_const">"];"</span>;
<span class="lineno" id="213">   213  </span>	}
<span class="lineno" id="214">   214  </span>
<span class="lineno" id="215">   215  </span>	<span class="comment doc">/**
<span class="lineno" id="216">   216  </span>	 * Reset all filters (clearing previous filters)
<span class="lineno" id="217">   217  </span>	 * @return Void
<span class="lineno" id="218">   218  </span>	 */</span>
<span class="lineno" id="219">   219  </span>	<span class="key">public</span> <span class="key">function</span> resetFilters():Void {
<span class="lineno" id="220">   220  </span>		_filters = [];
<span class="lineno" id="221">   221  </span>	}
<span class="lineno" id="222">   222  </span>
<span class="lineno" id="223">   223  </span>	<span class="comment doc">/**
<span class="lineno" id="224">   224  </span>	 * Check if an origin's output is being filtered
<span class="lineno" id="225">   225  </span>	 * @param origin (Object) to check.
<span class="lineno" id="226">   226  </span>	 * @return Boolean
<span class="lineno" id="227">   227  </span>	 */</span>
<span class="lineno" id="228">   228  </span>	<span class="key">public</span> <span class="key">function</span> isFiltered(origin:Object):Boolean {
<span class="lineno" id="229">   229  </span>		<span class="key">var</span> o:String = String( origin );
<span class="lineno" id="230">   230  </span>		<span class="key">for</span> (<span class="key">var</span> i:Number = <span class="num_const">0</span>; i &lt; _filters.length ; i++) {
<span class="lineno" id="231">   231  </span>			<span class="key">if</span> (_filters[i] == o) {
<span class="lineno" id="232">   232  </span>				<span class="key">return</span> <span class="key">true</span>;
<span class="lineno" id="233">   233  </span>			}
<span class="lineno" id="234">   234  </span>		}
<span class="lineno" id="235">   235  </span>		<span class="key">return</span> <span class="key">false</span>;
<span class="lineno" id="236">   236  </span>	}	
<span class="lineno" id="237">   237  </span>
<span class="lineno" id="238">   238  </span>	<span class="comment doc">/**
<span class="lineno" id="239">   239  </span>	 * Add an origin to the filters array.
<span class="lineno" id="240">   240  </span>	 * @param origin (Object) to be added.
<span class="lineno" id="241">   241  </span>	 * @return Void
<span class="lineno" id="242">   242  </span>	 */</span>
<span class="lineno" id="243">   243  </span>	<span class="key">private</span> <span class="key">function</span> filter(origin:Object):Void {
<span class="lineno" id="244">   244  </span>		<span class="key">var</span> o:String = String( origin );
<span class="lineno" id="245">   245  </span>		<span class="key">if</span> (!isFiltered( o )) {
<span class="lineno" id="246">   246  </span>			_filters.push( o );
<span class="lineno" id="247">   247  </span>		}
<span class="lineno" id="248">   248  </span>	}
<span class="lineno" id="249">   249  </span>
<span class="lineno" id="250">   250  </span>	<span class="comment doc">/**
<span class="lineno" id="251">   251  </span>	 * Remove an origin from the filters array.
<span class="lineno" id="252">   252  </span>	 * @param origin (Object) to be removed.
<span class="lineno" id="253">   253  </span>	 * @return Void
<span class="lineno" id="254">   254  </span>	 */</span>
<span class="lineno" id="255">   255  </span>	<span class="key">private</span> <span class="key">function</span> unfilter(origin:Object):Void {
<span class="lineno" id="256">   256  </span>		<span class="key">var</span> o:String = String( origin );
<span class="lineno" id="257">   257  </span>		<span class="key">for</span> (<span class="key">var</span> i:Number = <span class="num_const">0</span>; i &lt; _filters.length ; i++) {
<span class="lineno" id="258">   258  </span>			<span class="key">if</span> (_filters[i] == o) {
<span class="lineno" id="259">   259  </span>				_filters.splice( i, <span class="num_const">1</span> );
<span class="lineno" id="260">   260  </span>				<span class="key">break</span>;
<span class="lineno" id="261">   261  </span>			}
<span class="lineno" id="262">   262  </span>		}
<span class="lineno" id="263">   263  </span>	}	
<span class="lineno" id="264">   264  </span>
<span class="lineno" id="265">   265  </span>	<span class="comment">/*
<span class="lineno" id="266">   266  </span>	// currently unused - as3 has getNameSpace - for now maybe better to keep filtering on object/string rather than class?
<span class="lineno" id="267">   267  </span>	private function resolveOrigin ($origin) {
<span class="lineno" id="268">   268  </span>	var o = (typeof ($origin) == "string") ? $origin : $origin._classname;
<span class="lineno" id="269">   269  </span>	if (!o) {
<span class="lineno" id="270">   270  </span>	o = $origin;
<span class="lineno" id="271">   271  </span>	}
<span class="lineno" id="272">   272  </span>	trace (o);
<span class="lineno" id="273">   273  </span>	}
<span class="lineno" id="274">   274  </span>	 */</span>	
<span class="lineno" id="275">   275  </span>	 
<span class="lineno" id="276">   276  </span>	<span class="comment">// Output Handlers</span>
<span class="lineno" id="277">   277  </span>	<span class="key">private</span> <span class="key">function</span> _output(level:String, origin:Object, msg:Object):Void {
<span class="lineno" id="278">   278  </span>		<span class="comment">// validate that we should be outputting this content: Logger enabled, level enabled, origin unfiltered &amp; proper LogEvent.</span>
<span class="lineno" id="279">   279  </span>		<span class="key">if</span> (_isEnabled == <span class="key">false</span> || _levels[level] == <span class="key">false</span> || isFiltered( origin ) == <span class="key">true</span> || !(level.toLowerCase( ).indexOf( <span class="str_const">"__get__"</span> ) &lt;= -<span class="num_const">1</span>)) {
<span class="lineno" id="280">   280  </span>			<span class="key">return</span>;
<span class="lineno" id="281">   281  </span>		}
<span class="lineno" id="282">   282  </span>		<span class="key">var</span> benchmark:Number = _watch.lap( );
<span class="lineno" id="283">   283  </span>		<span class="key">var</span> id:Number = _logId++;
<span class="lineno" id="284">   284  </span>		<span class="key">var</span> e:LogEvent = <span class="key">new</span> LogEvent( {id:id, type:level.toLowerCase( ), origin:String( origin ), message:String( msg ), benchmark:benchmark} );
<span class="lineno" id="285">   285  </span>		
<span class="lineno" id="286">   286  </span>		<span class="comment">// dispatch event to localConnection Console</span>
<span class="lineno" id="287">   287  </span>		<span class="key">if</span>(_isOutputLC) {
<span class="lineno" id="288">   288  </span>			LCBinding.send( e );
<span class="lineno" id="289">   289  </span>		}
<span class="lineno" id="290">   290  </span>		<span class="comment">// dispatch event to embedded Console (only if isOutputLC is disabled to avoid duplicate Console entries)</span>
<span class="lineno" id="291">   291  </span>		<span class="key">if</span>(_isOutputSWF &amp;&amp; !_isOutputLC) {
<span class="lineno" id="292">   292  </span>			Dispatcher.$.dispatchEvent( e );
<span class="lineno" id="293">   293  </span>		}		
<span class="lineno" id="294">   294  </span>		<span class="comment">// dispatch event to output panel</span>
<span class="lineno" id="295">   295  </span>		<span class="key">if</span>(_isOutputIDE) {
<span class="lineno" id="296">   296  </span>			trace( id +<span class="str_const">" "</span> + level.toUpperCase( ) + <span class="str_const">"\t "</span> + origin + <span class="str_const">"\t "</span> + msg + <span class="str_const">"\t ("</span> + benchmark + <span class="str_const">" ms)"</span> );
<span class="lineno" id="297">   297  </span>		}
<span class="lineno" id="298">   298  </span>	}
<span class="lineno" id="299">   299  </span>
<span class="lineno" id="300">   300  </span>	<span class="key">public</span> <span class="key">function</span> setOutputMode(isLocal:Boolean, isRemote:Boolean, isIDE:Boolean):Void {	
<span class="lineno" id="301">   301  </span>	}
<span class="lineno" id="302">   302  </span>
<span class="lineno" id="303">   303  </span>	<span class="comment">// Level Overload	</span>
<span class="lineno" id="304">   304  </span>
<span class="lineno" id="305">   305  </span>	<span class="comment">// __resolve catches all wrapper &amp; invented levels and processes them thru the proxy to _output: cool!</span>
<span class="lineno" id="306">   306  </span>	<span class="key">private</span> <span class="key">function</span> __resolve(name:String):Function {
<span class="lineno" id="307">   307  </span>		<span class="key">if</span> (name.indexOf( LogEvent.onLogEVENT ) &gt; <span class="num_const">1</span>) {
<span class="lineno" id="308">   308  </span>			<span class="comment">//trace("!!!!!!!!! logger returning: "+name+" reflects: "+Stringifier.stringify(LogEvent));</span>
<span class="lineno" id="309">   309  </span>			<span class="key">return</span>;
<span class="lineno" id="310">   310  </span>		}
<span class="lineno" id="311">   311  </span>		<span class="key">var</span> f:Function = <span class="key">function</span>():Object {
<span class="lineno" id="312">   312  </span>			arguments.unshift( name );
<span class="lineno" id="313">   313  </span>			<span class="key">return</span> __proxy.apply( _proxyObj, arguments );
<span class="lineno" id="314">   314  </span>		};
<span class="lineno" id="315">   315  </span>		_proxyObj[name] = f;
<span class="lineno" id="316">   316  </span>		<span class="key">return</span> f;
<span class="lineno" id="317">   317  </span>	}
<span class="lineno" id="318">   318  </span>
<span class="lineno" id="319">   319  </span>	<span class="key">private</span> <span class="key">function</span> __proxy(name:String):Void {
<span class="lineno" id="320">   320  </span>		arguments.shift( );
<span class="lineno" id="321">   321  </span>		<span class="key">var</span> n:String = String( name ).toLowerCase( );
<span class="lineno" id="322">   322  </span>		<span class="key">var</span> o:String = String( arguments[<span class="num_const">0</span>] );
<span class="lineno" id="323">   323  </span>		<span class="key">var</span> s:String = String( arguments[<span class="num_const">1</span>] );
<span class="lineno" id="324">   324  </span>		_instance._output( n, o, s );
<span class="lineno" id="325">   325  </span>	}	
<span class="lineno" id="326">   326  </span>
<span class="lineno" id="327">   327  </span>	<span class="comment doc">/**
<span class="lineno" id="328">   328  </span>	 * Destroy the Singleton instance.
<span class="lineno" id="329">   329  </span>	 * @return Void
<span class="lineno" id="330">   330  </span>	 */</span>
<span class="lineno" id="331">   331  </span>	<span class="key">public</span> <span class="key">function</span> destroy():Void {
<span class="lineno" id="332">   332  </span>		_watch.destroy( );
<span class="lineno" id="333">   333  </span>		LCBinding.disconnect( );
<span class="lineno" id="334">   334  </span>		<span class="key">for</span>(<span class="key">var</span> i <span class="key">in</span> _instance) {
<span class="lineno" id="335">   335  </span>			<span class="key">delete</span> _instance[i];	
<span class="lineno" id="336">   336  </span>		}
<span class="lineno" id="337">   337  </span>		<span class="key">delete</span> _instance;
<span class="lineno" id="338">   338  </span>	}			
<span class="lineno" id="339">   339  </span>}</pre><ul class="main_nav" id="main_nav"><li><a href="../../../overview-summary.html" title="Overview of SASAPI" class="button">Overview</a></li><li><a href="package-summary.html" title="Overview of package com.sekati.log" class="button">Package</a></li><li><a href="Logger.html" title="Detail of com.sekati.log.Logger API" class="button">Class</a></li><li><span class="button nav_current">Source</span></li><li><a href="../../../index-files/index.html" title="Alpabetical index of types and members" class="button">Index</a></li></ul><div class="footer"><a href="http://www.badgers-in-foil.co.uk/projects/as2api/" title="ActionScript 2 API Documentation Generator">as2api</a></div></body></html>